
<div class="tab-pane fade" id="tab-equip">
  	<table class="table user-list" id="all-devices">
  		<thead>
  			<tr>
  				<th data-column-id="id"><span>ID</span></th>
  				<th data-column-id="name" data-sortable="false"><span>设备名称</span></th>
  				<th data-column-id="model" data-sortable="false"><span>设备型号</span></th>
  				<th data-column-id="description" data-formatter="description" data-sortable="false"><span>设备描述</span></th>
  				<th data-column-id="creator" data-sortable="false"><span>生产商</span></th>
  				<th data-column-id="minimize_price" data-sortable="false"><span>设备最低价</span></th>
  				<th data-column-id="maximize_price" data-sortable="false"><span>设备最高价</span></th>
  				<th data-column-id="verify_state" data-formatter="verify_state" data-sortable="false"><span>设备最高价</span></th>
  				<th data-sortable="false" data-formatter="commands"><span>操作</span></th>
  			</tr>
  		</thead>
  		<tbody>
  		</tbody>
  	</table>
</div>


<script type="text/javascript">
var labelsSetting = {
	infos: "当前第 {{ctx.start}} 条 到 {{ctx.end}} 条 共 {{ctx.total}} 条数据",
	search: "搜索",
	loading: "正在加载...",
	noResults: "未找到您要的数据...",
	refresh: "刷新",
	all: "全部"
};

$("#showDevice").click(function(){
  $("#all-devices").bootgrid({
    rowCount: [10, 25, 50],
      ajax:true,
      url: "get_user_device?uid="+uid+"",
      labels:labelsSetting,
      formatters: {
        "commands": function(k, row){
          return '<a href="javascript:void(0);" did="'+row.id+'" class="table-link doEdit"><span class="fa-stack"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-pencil fa-stack-1x fa-inverse"></i></span></a>' + '<a href="javascript:void(0);" did="'+row.id+'" class="table-link doDetail"><span class="fa-stack"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-search-plus fa-stack-1x fa-inverse"></i></span></a>';
        },
        "description": function(k, v){
          return v.description.substr(0, 19);
        },
        "verify_state": function(k, v){
          switch (v.verify_state){
            case 0:
              return '待审核';
              break;
            case 1:
              return '审核通过';
              break;
            case 2:
              return '审核不通过';
              break;
            default:
              break;
          }
        }
      }
  }).on("loaded.rs.jquery.bootgrid", function (e)
  {
    $(".doEdit").bind('click', function (){
      var did = $(this).attr('did');
      window.location.href="../device/edit_device?did="+did;
    })
    $(".doDetail").bind("click", function(){
      var did = $(this).attr('did');
      window.location.href="../device/detail_device?did="+did;
    })
  });

  $(".input-group").hide();
  $(".btn-group").hide();
})


</script>